package org.skavookie.spaces

/**
 * Created by IntelliJ IDEA.
 * User: joshua
 * Date: 10/2/11
 * Time: 3:39 PM
 * To change this template use File | Settings | File Templates.
 */

trait Metric[X,R] {
  /**
   * d(x,y) >= 0 for all x,y in X, and d(x,y)=0 if x=y
   * d(x,y) =  d(y,x) if x,y in X
   * d(x,y) <= d(x,z) + d(z,y) if x,y,z in X
   */
  def d(x: X, y: X): R
}

trait MetricNorm[X] extends Norm[X,Double] with Metric[X,Double] {
  def norm(x: X): Double  = math.sqrt(d(x,x))
}
